import type { CsCheckboxGroupProps } from 'csui'

type UseCsCheckbox<
  D extends Record<string, any>,
  P extends keyof Readonly<D>
> = UseFormItemProps<CsCheckboxGroupProps, D, P>

/**
 * el-input
 * @param prop item.prop
 * @param label item.label
 * @param props item的其他属性
 * @returns form-item-data
 */
export function useCsCheckbox<
  T extends Record<string, any>,
  P extends keyof T
>(prop: P, label: string, props: UseCsCheckbox<T, P> = {}): FormItemProps<T, P> {
  return {
    label,
    prop,
    component: 'cs-checkbox-group',
    ...props
  }
}
